package com.xinyi;

/**
 * @desc:
 * @author: Shoko
 * @date: 2025/3/16
 */
public class TestShapes {
    public static void main(String[] args) {
        try {
            Shape circle = ShapeFactory.createShape("CIRCLE");
            circle.draw();
            circle.erase();

            Shape rectangle = ShapeFactory.createShape("RECTANGLE");
            rectangle.draw();
            rectangle.erase();

            Shape triangle = ShapeFactory.createShape("TRIANGLE");
            triangle.draw();
            triangle.erase();

            // 测试不支持的类型
            Shape unknown = ShapeFactory.createShape("HEXAGON");
            unknown.draw();
        } catch (UnsupportedShapeException e) {
            System.out.println("Error: " + e.getMessage());
        }
    }
}
